#include "CustomPrintOperation.h"
#include <string>


CustomPrintOperation::CustomPrintOperation(AreaDibujo * pd, Circuito* circuito){
	this->pDrawing = pd;
	this->circuito = circuito;
}

Glib::RefPtr<CustomPrintOperation> CustomPrintOperation::create(AreaDibujo * pd, Circuito* circuito){
	return Glib::RefPtr<CustomPrintOperation>(new CustomPrintOperation(pd, circuito));
}

void CustomPrintOperation::on_begin_print(
        const Glib::RefPtr<Gtk::PrintContext>& print_context){
	set_n_pages(1);
}


void CustomPrintOperation::on_draw_page(const Glib::RefPtr<Gtk::PrintContext>& print_context, int page_nr){
	Cairo::RefPtr<Cairo::Context> cairo_ctx = print_context->get_cairo_context();
	float x = print_context->get_width();
	float y = print_context->get_height();
	this->pDrawing->pintar_en_contexto(cairo_ctx, x, y);

}

CustomPrintOperation::~CustomPrintOperation(){

}
